package com.example.myapplication.module1

import androidx.recyclerview.widget.GridLayoutManager

/**
 * 列表动态变换多列表Grid
 */
class ItemGridSpanSizeLookup(private val itemList: MutableList<Any>, private val spanSize: Int) :
    GridLayoutManager.SpanSizeLookup() {

    override fun getSpanSize(position: Int): Int {
        return when (itemList[position]) {
            is String -> {
                spanSize
            }
            else -> {
                1
            }
        }
    }
}